﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Client.HelpTools
{
    public static class IOC
    {
        private static Dictionary<string, object> ContainerObject { get; set; }=new Dictionary<string, object>();
        /// <summary>
        /// 获取对象
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public static T Getobject<T>() where T : class, new()
        {
            var d = typeof(T);
            if (ContainerObject.ContainsKey(d.FullName))
            {
                return ContainerObject[d.FullName] as T;
            }
            else
            {
                var data = new T();
                ContainerObject.Add(d.FullName, data);
                return data;
            }
           
        }

    }
}
